<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<tiles:insertDefinition name="layout">
	<tiles:putAttribute name="head">
		<style type="text/css">
.selected {
	visibility: hidden;
}
</style>
		<script type="text/javascript">
			$(function() {
				$("#datepicker").datepicker({
					showWeek : true,
					firstDay : 1,
					dateFormat : 'yy-mm-dd',
					showOtherMonths : true,
					selectOtherMonths : true,
					onSelect : function(date, source) {
						$("form").submit();
					}
				});
			});
		</script>
	</tiles:putAttribute>
	<tiles:putAttribute name="mainBody">
		<form class="form-horizontal">
			<fieldset>
				<legend>每日课程表</legend>
				<div class="control-group">
					<div class="control-label">日期选择</div>
					<div class="controls">
						<a href="?startDate=${preDate}" class="btn">
							<i class="icon-chevron-left"></i>
						</a>
						<input type="text" name="startDate" id="datepicker" value="${currentDate}" />
						<a href="?startDate=${nextDate}" class="btn">
							<i class="icon-chevron-right"></i>
						</a>
					</div>
				</div>
			</fieldset>
		</form>
		<table class="table">
			<thead>
				<tr>
					<th>Time</th>
					<th>Lesson</th>
					<th>Teacher</th>
					<th>Classroom</th>
				</tr>
			</thead>
			<tbody>
				<s:iterator value="lessons" var="lesson">
					<tr class="${lesson.courseType.cssClass}">
						<td>${lesson.timespan}</td>
						<td><s:url action="listListener" namespace="/lesson" id="listListener">
								<s:param name="id" value="id"></s:param>
							</s:url> <a href="${listListener}">${lesson.name}</a> <s:if test="canceled">
								<span class="label">已取消</span>
							</s:if></td>
						<td><s:iterator value="teachings" var="teaching" status="status">
								${teaching.teacher.name}
								<s:if test="!status.last">,</s:if>
							</s:iterator></td>
						<td>${lesson.classroom.name}</td>
					</tr>
				</s:iterator>
			</tbody>
			<tfoot></tfoot>
		</table>
	</tiles:putAttribute>
</tiles:insertDefinition>